<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>店面自营产品管理</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
		#searchForm fieldset{
			display:inline-block;
		}
	</style>
	<script type="text/javascript">
		global.loginPassword = "${fns:getLoginPw()}";
		$(document).ready(function() {
			$("#contentTable tbody tr").click(function(){
				$("#contentTable tbody tr").removeClass("select_active");
				$(this).addClass("select_active");
			});
			var currentId = '${currentId}';
			if(currentId == ''){
				$("#contentTable tbody tr:first-child").click();
			} else {
				$("#" + currentId).click();
			}
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
<div class="icon-buttons">
	<a href="${ctx}/base/storeSelfProductCategory/" data-icon="back" data-iconpos="notext" data-role="button" data-inline="true">返回</a>
</div>
	<form:form id="searchForm" modelAttribute="storeSelfProduct" action="${ctx}/base/storeSelfProduct/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input id="category_id" name="category_id" type="hidden" value="${parent.id}"/>
		<input type="button" value="店面产品添加" data-inline="true" onclick="loginPasswordPopup('${ctx}/base/storeSelfProduct/form')">
		<label>(当前产品分类：${parent.name})</label>&nbsp;&nbsp;
		<label>按条件查询：</label>
		<fieldset data-role="controlgroup" data-type="horizontal" data-inline="true">
	        <input type="radio" name="status" id="radio-choice-a" value="0" ${empty status || status == '0' ? 'checked' : ''}>
	        <label for="radio-choice-a">可用</label>
	        <input type="radio" name="status" id="radio-choice-b" value="1" ${status == '1' ? 'checked' : ''}>
	        <label for="radio-choice-b">不可用</label>
		</fieldset> 
		<input id="productName" name="productName" type="search" value="${productName}"/>
		<input id="btnSubmit" type="submit" value="查询" data-inline="true"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" data-role="table" class="ui-responsive table-stroke">
		<thead><tr><th>产品名称</th><th>产品规格</th><th>零售价</th><th>当前状态</th><th>操作</th></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="storeSelfProduct">
			<tr id='${storeSelfProduct.id}'>
				<td>${storeSelfProduct.name}</td>
				<td>${storeSelfProduct.spec}</td>
				<td>${storeSelfProduct.retail_price}</td>
				<td>${storeSelfProduct.status == 0 ? '可用':'不可用'}</td>
				<td class="detail-oper">
    				&nbsp;&nbsp;<a data-role="button" data-inline="true"  href="${ctx}/base/storeSelfProduct/form?id=${storeSelfProduct.id}" target="_parent">修改</a>
					&nbsp;&nbsp;<a data-role="button" data-inline="true"  href="${ctx}/base/storeSelfProduct/status?id=${storeSelfProduct.id}" onclick="return confirmx('确认要改变该店面自营产品的状态吗？', this.href)">${storeSelfProduct.status == 0 ? '停用':'启用'}</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
